package com.alibaba.ribbonresttemplate;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.springframework.cloud.netflix.ribbon.RibbonClient;
import org.springframework.cloud.netflix.ribbon.RibbonClients;
import org.springframework.context.annotation.Bean;
import org.springframework.web.client.RestTemplate;

//@RibbonClient(name = "ribbon-server",configuration = RibbonConfig.class)//访问ribbon-server时，采用RibbonConfig的配置
//@RibbonClients(defaultConfiguration = RibbonConfig.class)//所有的微服务都采用RibbonConfig的配置
@SpringBootApplication
public class RibbonResttemplateApplication {

    public static void main(String[] args) {
        SpringApplication.run(RibbonResttemplateApplication.class, args);
    }


    @Bean
    @LoadBalanced
    public RestTemplate restTemplate() {
        return new RestTemplate();
    }
}
